
# 生产者(Producer):		生成任务（函数）
"""
1. celery的任务[函数] 必须要让celery实例的 task装饰器装饰
2. celery的任务[函数] 需要让celery检测到
"""
from celery_tasks.main import app
from ronglian_sms_sdk import SmsSDK

@app.task
def celery_send_sms_code(mobile,sms_code,time):
    accId = '8aaf070878d419aa017901c8dd32124a'
    accToken = '095502c8c00f40faa585474b58b42da6'
    appId = '8aaf070878d419aa017901c8de251251'
    sdk = SmsSDK(accId, accToken, appId)

    tid = '1'  # 只能用1
    mobile = '{}'.format(mobile)
    datas = (sms_code, time)
    sdk.sendMessage(tid, mobile, datas)
